package com.xinghen.rms.web;

import com.xinghen.core.RestResponse;
import com.xinghen.rms.RmsConfig;
import com.xinghen.rms.RmsProperties;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xinghen
 * @ClassName: RmsController
 * @Package: com.xinghen.rms.web
 * @Description RmsController
 * @create 2017-12-08 11:47
 */
@Api(value = "rest服务", consumes = "application/json", produces = "application/json", protocols = "http")
@RestController
@RequestMapping("service/rms")
public class RmsController {

    @Autowired
    private RmsConfig rmsConfig;

    @Autowired(required = false)
    private RmsProperties rmsProperties;

    /**
     * 返回rms扫描路径
     *
     * @return
     */
    @ApiOperation(value = "RMS_1", notes = "返回rms扫描路径")
    @GetMapping("path/pattern")
    public RestResponse<String> getPathPattern() {
        return new RestResponse<>(rmsConfig.getRmsPathPatterns());
    }

    @ApiOperation(value = "RMS_2", notes = "获得rms配置详情")
    @RequestMapping(value = "properties", method = RequestMethod.GET)
    public RestResponse<RmsProperties> getProperties() {
        return new RestResponse<>(rmsProperties);
    }

}
